/**
 * 第二种方法
 **/
/*var _instance = null;

function Class(time) {
  this.name = 'andy';
  this.book = 'Nodejs';
  this.time = time;
  this.show = function() {
    console.log(this.book + ' is write by ' + this.name + ',time is ' + this.time);
  };
  this.getInstance = function() {
    if (_instance === null) {
      _instance = new Class(time);
    }
    return _instance;
  };
}
module.exports = Class;*/


/**
 * 第二种方法
 **/


 var _instance = null;
 module.exports = function(time) {
  function Class(time) {
    this.name = 'andy';
    this.book = 'Nodejs';
    this.time = time;
  }
  Class.prototype = {
    constructor: Class,
    show: function() {
      console.log(this.book + ' is write by ' + this.name + ',time is ' + this.time);
    }
  };
  this.getInstance = function(time) {
    if (_instance === null) {
      _instance = new Class(time);
    }
    return _instance;
  };
};

